<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        const str = 'a';// ab / ac / a
        // console.log(str.match(/ab{0,1}c{0,1}/));
        // console.log(str.match(/ab?c?/));
        console.log(str.match(/a(bc){0,1}/)); // abc a










    </script>
</body>

</html>